<?php
/**
 * Created by PhpStorm.
 * User: zyark
 * Date: 2017/8/15
 * Time: 17:09
 */

namespace Admin\Logic;


class MoneyLogLogic
{
    /**
     * 存储用户资金流动
     * @param $money float 金额
     * @param $current_money float 当前金额
     * @param $type int 来源
     * @param $put_type  int 收入或支出
     * @param $remark string 备注
     * @param $user_id int 用户id
     * @param $money_type int 资金类型
     * @param $model object 事务model
     */
    public function saveMoneyLog($money,$current_money,$type,$put_type,$remark,$user_id,$money_type,$model){
        $log['money'] = $money;
        $log['current_money'] = $current_money;
        $log['type'] = $type;
        $log['put_type'] = $put_type;
        $log['remark'] = $remark;
        $log['user_id'] = $user_id;
        $log['money_type'] = $money_type;
        $log['create_time'] = time();
        $model->table('t_money_log')->add($log);
    }

    /**
     * 存储用户资金流动
     * @param $money float 金额
     * @param $current_money float 当前金额
     * @param $type int 来源
     * @param $put_type  int 收入或支出
     * @param $remark string 备注
     * @param $user_id int 用户id
     * @param $money_type int 资金类型
     * @param $source_id int 来源id
     * @param $model object 事务model
     */
    public function saveMoneyLogBySourceId($money,$current_money,$type,$put_type,$remark,$user_id,$money_type,$source_id,$model){
        $log['money'] = $money;
        $log['current_money'] = $current_money;
        $log['type'] = $type;
        $log['put_type'] = $put_type;
        $log['remark'] = $remark;
        $log['user_id'] = $user_id;
        $log['money_type'] = $money_type;
        $log['source_id'] = $source_id;
        $log['create_time'] = time();
        $model->table('t_money_log')->add($log);
    }
}